{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "os.environ[\"CUDA_VISIBLE_DEVICES\"] = \"-1\"\n",
    "from tensorflow.keras.datasets import mnist\n",
    "import matplotlib.pyplot as plt\n",
    "(X_train, y_train), (X_test, y_test) = mnist.load_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAGaCAYAAAAl0cWXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deZRU1bn38d+DMjkwKdcpAiooClcMcYiECySCKEERjUQDImqEK1HR92riQAzGiKKJKwQiGo2zb9DEAGrkqomgRpRXTXAtRBT1giAgKraMQsD9/tF9V/rZ0equ3lV1qprvZ61e1K/rVJ1d3Zt6ep9d52wLIQgAgIZqknUDAACVjUICAEhCIQEAJKGQAACSUEgAAEkoJACAJBVXSMxsqZn1r+e2wcw6N3A/DX4sskc/QX3QTwqj4gpJOTCze8xsq5ltqPW1U9btQnkxs+ZmdpeZrTOz1Wb2f7JuE8qXmbUzsw/N7K9ZtyVfFJKGuymEsFutr+1ZNwhlZ4KkLpI6SvqmpB+a2QmZtgjlbJKkN7JuRENUdCExs6PN7EUzqzKzVWY21cyaRZsNMrN3zewjM7vZzJrUevy5ZvaGmX1iZk+aWccSvwSUQIb95GxJ14UQPgkhvCHpDkmjCvOqUGhZvp+YWS9J3SXdXaCXU1IVXUgkbZd0qaQ9JR0r6ThJY6Nthko6UlJPSUMknStJZjZE0lWSTpXUXtLzkn6Xx77HmtlaM3vVzE5LeREoupL3EzNrK2kfSa/V+vZrkrolvA4UVybvJzWHxadKulBSZV6zKoRQUV+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yCE574/P86p0cT+O50zeeustl+N+nSVGJACAJBQSAEASCgkAIEmjmiOJr50VnzcSX6PojjvucHnOnDkux8fOf/3rX7scX6MJpfHVr37V5XhOJDZkyBCX4/VFUJlefvnlrJuQU3xNtxNOOMHlESNGuHz88cfnfL7rrrvO5aqqqoTWFRYjEgBAEgoJACAJhQQAkKRRzZHE3nnnHZdHjRrl8t133+3yWWedlTPvuuuuLt93330ux9dsQnHccsstLsdrnMdzIOU+JxKvRc413+qnXbt2SY+P1y+K+1F8ntlXvvIVl5s1a+ZyfA20+Pe6efNml+fPn+/yli1bXN55Z//2/Oqrr6pcMSIBACShkAAAklBIAABJGvUcSWzGjBkuL1myxOX42Ptxxx3n8sSJE13u2LGjy9dff73L5bReQCUbPHiwy/Ga7PH5PI8++mjR21RI8ZxI/HoWLFhQyuaUjXhOIf653HbbbS5fddVVeT1/vCZ8PEeybds2lzdt2uTyokWLXL7rrrtcjs9Di+fqPvjgA5dXrFjhcnzNt8WLF6tcMSIBACShkAAAklBIAABJdqg5ktjChQtdHjZsmMsnnXSSy/F5J2PGjHG5S5cuLg8YMCC1idC/HiuOP7+/Zs0alx966KGitykf8fop8bo5sWeeecblK6+8stBNqghjx451edmyZS736tUr6fnfe+89l2fOnOnyG2+84fJLL72UtL/Y6NGjXW7fvr3L7777bkH3V0yMSAAASSgkAIAkFBIAQJIdeo4kFl/f//7773f5zjvvdDm+Fk6fPn1c7tevn8tz585NayC+UHyNoqyveRbPiYwfP97lyy+/3OX4/IFf/OIXLm/YsKGAratckyZNyroJBRWfpxZ75JFHStSSdIxIAABJKCQAgCQUEgBAkh16jiS+1s53vvMdl4866iiX4zmRWHztneeeey6hdaivrK+tFV/7K54D+e53v+vyrFmzXD7ttNOK0zBUtPjagOWMEQkAIAmFBACQhEICAEjSqOdIDjnkEJcvvPBCl0899VSX995777yef/v27S7H5y+w9nZhxOtExPmUU05xedy4cUVtz6WXXuryj3/8Y5dbt27t8oMPPujyyJEji9MwICOMSAAASSgkAIAk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gBIQiEBACRhjiQPo0aNcvlHP/qRy59//nnOx4cQCt0kABnp1KmTy/H7wbHHHuty9+7d83r+ffbZx+WLL744r8eXEiMSAEASCgkAIAmFBACQhDmSPHTs2NHlFi1aZNQSFNIxxxzj8ogRI1zu27evy926dcv5fJdddpnLK1eudLl3794uP/DAAy7Pnz8/5/OjNLp27eryJZdc4vLw4cNdbtmypctm5vLy5ctdXr9+vcuHHnqoy8OGDXP51ltvdXnx4sVf1OxMMCIBACShkAAAklBIAABJmCPJoX///i5fdNFFObePj1kOHjzY5Q8++KAwDUOS7373uy5PnjzZ5T333NPl+Fj33LlzXY6vkXTzzTfn3H/8fPHjzzjjjJyPR2G0bt3a5UmTJrkc95P42ll1WbJkicsDBw50uWnTpi7H7x9xP4xzOWFEAgBIQiEBACShkAAAkjBHUkv8+f67777b5fiYaiw+Nr5s2bLCNAx52Xln362PPPJIl++44w6Xd9llF5efe+45l6+77jqX//rXv7rcvHlzlx9++GGXjz/++JztfeWVV3Lej+IYOnSoy9///veTnu+dd95xecCAAS7H55F07tw5aX/lhBEJACAJhQQAkIRCAgBIwhxJLWeffbbL++67b87t4/MJ7rvvvkI3CQ0QXyvrzjvvzLn9008/7XJ8/sC6detyPj7evq45kRUrVrh877335twexXH66afntf3SpUtdfvnll12O1yOJ50Ri8bW1KhkjEgBAEgoJACAJhQQAkGSHniOJr11z7rnnuhyvwV5VVeXyz372s+I0DHmJz/O46qqrXA4huByv6zB+/HiX65oTiV199dV5bR+vvf3hhx/m9XgUxvnnn+/y6NGjXX7qqadcfvvtt11es2ZN0v732muvpMeXE0YkAIAkFBIAQBIKCQAgyQ41R9KpUyeXH3nkkbweP2XKFJfnzJmT2iQ0wDXXXONyPCeydetWl5988kmX48/7b968Oef+WrRo4XJ8nkiHDh1cjtcbiefSZs2alXN/KI2VK1e6PGHChJLu/9hjjy3p/oqJEQkAIAmFBACQhEICAEiyQ82RnHDCCS4ffvjhObf/y1/+4nK8tjdKo02bNi6PHTvW5fg8kXhO5JRTTslrf/E6EQ8++KDLX/va13I+/g9/+IPLN910U177R2WIzwfadddd83r8v//7v+e8f968eS6/+OKLeT1/KTEiAQAkoZAAAJJQSAAASSw+vuzuNPvyOytAfGz8nnvucTk+phkfkxw2bJjLH3zwQeEaVwIhBKt7q3TF7if/9m//5nL8+f/YgQce6PJnn33m8jnnnOPyySef7HL37t1d3m233VyO/8/E+dRTT3X5sccey9nerDWWfpJql112cfmwww5z+Sc/+YnLgwYNyvl8TZr4v9Pja/fF4n7dr18/l+M14UstVz9hRAIASEIhAQAkoZAAAJI0qvNIUq+l9e6777pcaXMijVV87ax4/Y727du7/D//8z8u55oH/CLxsep4fZJ99tnH5Y8++sjlcp8T2VE1bdrU5a9+9asux+8X8e85viZb3E/i8zzi89biOZjYzjv7t+N4ri0+jy3+f5ElRiQAgCQUEgBAEgoJACBJo5ojideZqOtz27Ebb7yxkM1BgVRVVbkcnx/0+OOPu9yuXTuX48/fx+uBxOcXrV271uXp06e7HB87j+9HeWjWrJnL8ZzFH//4x5yPv/baa11+5plnXH7hhRdcjvtdvH18flIsnuu74YYbXH7vvfdcnjlzpstbtmzJ+fzFxIgEAJCEQgIASEIhAQAkqeg5kiOOOMLleC3tusTHyt98883kNqH45s+f73J8bDlVnz59XO7bt6/L8dxbfP4RshGfJxLPcVx++eU5Hz979myXp0yZ4nI8Vxf3uyeeeMLleL2R+LyPeJ2aeA5lyJAhLsfr4vz5z392edKkSS5/8sknymXBggU5788HIxIAQBIKCQAgCYUEAJCkotcjWbNmjctt27bNuf1LL73k8oknnujyhg0bCtOwMsE6Ew0zcOBAl+Nj3/H/mfi8kvhaYOWuUvvJTjvt5PL111/v8mWXXebyxo0bXb7iiitcjs8HiucYjjzySJenTp2a8/63337b5QsuuMDlOXPmuNyqVSuXe/Xq5fLw4cNdjtfRqWvN+OXLl7t8wAEH5Nw+xnokAICioZAAAJJQSAAASSp6jmT79u0u13VtrZEjR7r8u9/9ruBtKieVeuy73MT9jDmShil0P4nnHOLzPjZ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CP2mY0047zeXf//73Lsfryhx22GEuL1u2rDgNK5Jc/YQRCQAgCYUEAJCEQgIASLJDnUdy2223uTxmzJi8Hj969GiXL7nkkuQ2ofINHDgw6yYgA9u2bct5f3yNt+bNmxezOZliRAIASEIhAQAkoZAAAJLsUHMkixcvzroJaICmTZu6fPzxx7v8zDPPuBx/fr/QzjnnHJcnT55c1P2hPM2aNcvl+P2la9euLsdzqmPHji1OwzLAiAQAkIRCAgBIQiEBACTZoa61FXvrrbdcPuigg3JuH69n0rlzZ5ffeeedwjSsQCr1Gkq9e/d2+eqrr3Z5wIABLh9wwAEuL1++PGn/7dq1c3nQoEEuT5kyxeXdd9895/PFczbxWt7xuhalVqn9pNz88pe/dDmeS9trr71cTl0Hp9S41hYAoGgoJACAJBQSAECSHeo8ktjrr7/u8oEHHphz+7rWeEdhTJ061eXu3bvn3P6HP/yhy+vXr0/afzwH07NnT5frWsdm7ty5Lk+bNs3lrOdEUBpxP9m6dWtGLSk+RiQAgCQUEgBAEgoJACDJDj1H8pvf/MbleC1tVIYLLrigpPtbs2aNy4899pjL48aNc7nSzhdAYbRq1crlIUOGuDxjxoxSNqeoGJEAAJJQSAAASSgkAIAkO/QcyaJFi1x+4403XD700ENL2RzUGDVqlMsXXXSRy2effXZB9xdfI23Tpk0uP//88y7Hc2sLFy4saHtQmYYNG+byli1bXI7fXxoTRiQAgCQUEgBAEgoJACDJDr0eSWPXWNaZaN68ucvxHMrPfvYzl9u2bevyzJkzXX766addjtfeXr16dUOaWbEaSz/J2vTp012O51jjdWiWLVtW9DYVEuuRAACKhkICAEhCIQEAJGGOpBHj2Dfqg36C+mCOBABQNBQSAEASCgkAIAmFBACQhEICAEhCIQEAJKGQAACSUEgAAEkoJACAJBQSAEASCgkAIEnOa20BAFAXRiQAgCQUEgBAEgoJACAJhQQAkIRCAgBIQiEBACT5/zwz7KwdpFHNAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 9 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.rcParams['figure.figsize'] = (7,7)\n",
    "offset = 0\n",
    "for i in range(9):\n",
    "    plt.subplot(3,3,i+1)\n",
    "    plt.imshow(X_train[i+offset], cmap='gray', interpolation='none')\n",
    "    plt.title(\"label {}\".format(y_train[i+offset]))\n",
    "    plt.axis('off')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(60000, 28, 28)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   3,\n",
       "         18,  18,  18, 126, 136, 175,  26, 166, 255, 247, 127,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,  30,  36,  94, 154, 170,\n",
       "        253, 253, 253, 253, 253, 225, 172, 253, 242, 195,  64,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,  49, 238, 253, 253, 253, 253,\n",
       "        253, 253, 253, 253, 251,  93,  82,  82,  56,  39,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,  18, 219, 253, 253, 253, 253,\n",
       "        253, 198, 182, 247, 241,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,  80, 156, 107, 253, 253,\n",
       "        205,  11,   0,  43, 154,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,  14,   1, 154, 253,\n",
       "         90,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 139, 253,\n",
       "        190,   2,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  11, 190,\n",
       "        253,  70,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  35,\n",
       "        241, 225, 160, 108,   1,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "         81, 240, 253, 253, 119,  25,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,  45, 186, 253, 253, 150,  27,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,  16,  93, 252, 253, 187,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0, 249, 253, 249,  64,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,  46, 130, 183, 253, 253, 207,   2,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  39,\n",
       "        148, 229, 253, 253, 253, 250, 182,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  24, 114, 221,\n",
       "        253, 253, 253, 253, 201,  78,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,  23,  66, 213, 253, 253,\n",
       "        253, 253, 198,  81,   2,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,  18, 171, 219, 253, 253, 253, 253,\n",
       "        195,  80,   9,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,  55, 172, 226, 253, 253, 253, 253, 244, 133,\n",
       "         11,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0, 136, 253, 253, 253, 212, 135, 132,  16,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0]], dtype=uint8)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
